package com.slz3.business.module.drawManagement.draIntegralLottery.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.drawManagement.draIntegralLottery.domain.DraIntegralLottery;
import com.slz3.business.module.drawManagement.draIntegralLottery.domain.DraIntegralLotteryCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class DraIntegralLotteryResController {

    @Resource
    private DraIntegralLotteryResAtomic draIntegralLotteryResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, DraIntegralLottery draIntegralLottery) {
        if (DraIntegralLotteryResUnsafeValid.add(req, draIntegralLottery)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.add_$DraIntegralLotteryUpdateLock(req, draIntegralLottery);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.delete(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.delete_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, DraIntegralLottery draIntegralLottery) {
        if (DraIntegralLotteryResUnsafeValid.modify(req, draIntegralLottery)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.modify_$DraIntegralLotteryUpdateLock(req, draIntegralLottery);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (DraIntegralLotteryResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return DraIntegralLotteryResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return draIntegralLotteryResAtomic.info_$DraIntegralLotteryUpdateLock(req);
        if (DraIntegralLotteryResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.info_$DraIntegralLotteryUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (DraIntegralLotteryResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return DraIntegralLotteryResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        //
        if (DraIntegralLotteryResUnsafeValid.auditSubmit(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.auditSubmit_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.audit(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.audit_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.auditReject(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.auditReject_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.usingEnable(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.usingEnable_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.usingDisable(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.usingDisable_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }
    public Mono<? extends ServerResponse> lottery(ServerRequest req, DraIntegralLotteryCondition draIntegralLotteryCondition) {
        if (DraIntegralLotteryResUnsafeValid.lottery(req, draIntegralLotteryCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return draIntegralLotteryResAtomic.lottery_$DraIntegralLotteryUpdateLock(req, draIntegralLotteryCondition);
        }
    }
}
